//
//  AboutUsController.m
//  GuShiNews
//
//  Created by 丁一 on 2019/8/17.
//  Copyright © 2019 Jones. All rights reserved.
//

#import "AboutUsController.h"
#import "CenterAction.h"
#import "HiContactController.h"

@interface AboutUsController ()

@end

@implementation AboutUsController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"关于我们";
    [self.view addSubview:self.TableView];
    self.TableView.separatorInset      = UIEdgeInsetsMake(0, 10, 0, 0);
    self.TableView.separatorStyle      = UITableViewCellSeparatorStyleSingleLineEtched;
    self.TableView.separatorColor      = [JonesClass stringTOColor:@"#e9e9e9"];
    self.TableView.backgroundColor = [JonesClass stringTOColor:@"#fbfbfb"];
}

- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
    return nil;
}

- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state {
    NSString *text = @"";
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
    [attStr addAttribute:NSFontAttributeName
                   value:[UIFont systemFontOfSize:14.0]
                   range:NSMakeRange(0, text.length)];
    [attStr addAttribute:NSForegroundColorAttributeName
                   value:[JonesClass stringTOColor:@"#cccccc"]
                   range:NSMakeRange(0, text.length)];
    return attStr;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 45;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 300;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return RECERHEIGHT-340-NAV_Height-45;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString* cellIdentifier = @"cell";
    UITableViewCell *cell           = [tableView cellForRowAtIndexPath:indexPath];
    if (!cell) {
        cell                 = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        [cell setShowsReorderControl:YES];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.backgroundColor=[UIColor whiteColor];
        
        cell.textLabel.text=@"联系我们";
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    HiContactController *convc = [HiContactController new];
    convc.type = 0;
    [self.navigationController pushViewController:convc animated:YES];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor=[UIColor clearColor];
    [headerView setFrame:CGRectMake(0, 0, RECRWITCH, 280)];
    
    UIImageView *LoginImage = [[UIImageView alloc] initWithFrame:CGRectMake(RECRWITCH/2-35, 40, 70, 70)];
    LoginImage.backgroundColor=[UIColor grayColor];
    LoginImage.image=[UIImage imageNamed:@"logo.png"];
    LoginImage.layer.masksToBounds=YES;
    LoginImage.layer.cornerRadius = 10;
    [headerView addSubview:LoginImage];
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *appCurVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    NSString *appCurName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    
    UILabel    *titleLabel = [[UILabel alloc] init];
    [titleLabel setFrame:CGRectMake(0, 120, RECRWITCH, 30)];
    [titleLabel setText:[NSString stringWithFormat:@"%@ %@版本",appCurName,appCurVersion]];
    [titleLabel setFont:[UIFont systemFontOfSize:18]];
    [titleLabel setTextColor:[JonesClass stringTOColor:@"#000000"]];
    [titleLabel setTextAlignment:NSTextAlignmentCenter];
    [headerView addSubview:titleLabel];
    
    UILabel *CellTitle = [[UILabel alloc] init];
    [CellTitle setFrame:CGRectMake(15, 160, RECRWITCH-30, 110)];
    [CellTitle setFont:[UIFont systemFontOfSize:16.0f]];
    [CellTitle setNumberOfLines:0];
    [CellTitle setTextColor:[JonesClass stringTOColor:@"#333333"]];
    CellTitle.text=@"      及时体育!一款集篮球、排球、足球、电竞等相关体育新闻的客户端，不仅如此，在这里还可以实现和体友的交流，同时可以结交好朋友。";
    [headerView addSubview:CellTitle];
    
    return headerView;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *FootBgView = [[UIView alloc] init];
    [FootBgView setFrame:CGRectMake(0, 0, RECR.size.width, RECERHEIGHT-300-NAV_Height)];
    UILabel *yunyin = [[UILabel alloc] init];
    [yunyin setFrame:CGRectMake(0, RECERHEIGHT-340-NAV_Height, RECR.size.width, 20)];
    [yunyin setText:@"©️2019-2019密西西团队出品"];
    yunyin.textColor=[JonesClass stringTOColor:@"#999999"];
    yunyin.font=[UIFont systemFontOfSize:11];
    yunyin.textAlignment=NSTextAlignmentCenter;
    [FootBgView addSubview:yunyin];
    return FootBgView;
}

@end
